﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Servicios_Escolares_AltaUsuarios : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("../Default.aspx");
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        
        if (txtCorreo.Text != "" && txtUser.Text != "" && ddlcarreras.SelectedValue != "")
        {
            if (txtPAss.Text == txtConfirm.Text)
            {
                object[] formulario = new object[4];

                formulario[0] = txtUser.Text;
                formulario[1] = ddlcarreras.SelectedValue;
                formulario[2] = txtCorreo.Text;
                formulario[3] = txtPAss.Text;
                login log = new login();

                log.Agregarusu(formulario);
                this.limpiar();
            }
            else//segundo if de la contraseña 
            {
                Response.Write("<script language='javascript'>alert('La confirmacion de la contraseña no es igual');</script>");
            }

        }
        else//Primer if de los campos de texto
        {
            Response.Write("<script language='javascript'>alert('Todos los campos son obligatorios');</script>");
        }
    }

    public void limpiar() 
    {
        txtUser.Text = "";
        ddlcarreras.SelectedValue = "0";
        txtCorreo.Text = "";
        txtPAss.Text = "";
    }
}